package com.example.second.iterator;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;

import com.example.second.R;
import com.example.second.iterator.classes.NameRepository;

import java.util.Iterator;

public class IteratorActivity extends AppCompatActivity {
    private static final String TAG = "IteratorActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_iterator);

        NameRepository nameRepository = new NameRepository();
        nameRepository.addName("zhangSan");
        nameRepository.addName("liSi");
        nameRepository.addName("wangWu");
        nameRepository.addName("zhaoLiu");

        Iterator<String> iterator = nameRepository.getIterator();
        while (iterator.hasNext()) {
            Log.d(TAG, "onCreate: " + iterator.next());
        }
    }
}